package com.yonyou.cyxdms.sysmanage.client.service.login;

import java.util.List;
import java.util.Set;

import com.yonyou.cyxdms.sysmanage.client.vo.role.RoleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yonyou.cyxdms.sysmanage.client.feign.SysmanageDataCommonClient;
import com.yonyou.cyxdms.sysmanage.client.vo.employee.EmployeeOrgsVO;
import com.yonyou.cyxdms.sysmanage.client.vo.employee.EmployeeVO;
import com.yonyou.cyxdms.sysmanage.client.vo.employee.UserInfoVO;
import com.yonyou.cyxdms.sysmanage.client.vo.role.UserbyRoleVO;

@Service
public class EmployeeClientServiceImpl implements EmployeeClientService {

    @Autowired
    SysmanageDataCommonClient sysmanageDataCommonClient;

    @Override
    public List<EmployeeVO> getEmployees(String queryCondition) {
        return sysmanageDataCommonClient.getEmployees(queryCondition).getData();
    }

    /**
     * 查询本组织下的销售人员
     *
     * @author 李贺
     * @since 2019/9/9
     */
    @Override
    public List<EmployeeOrgsVO> getSalesman() {
        return sysmanageDataCommonClient.getSalesman().getData();
    }


    /**
     * 根据roleposition获取user
     *
     * @author maxingjian
     * @since 2019/9/18
     */
    @Override
    public List<UserbyRoleVO> getUserInfoByRolePosition(String positionCode, String companyId, String ownerCode) {
        return sysmanageDataCommonClient.getUserInfoByRolePosition(positionCode,companyId,ownerCode).getData();
    }

    /**
     * 根据role获取user
     *
     * @author maxingjian
     * @since 2019/9/18
     */
    @Override
    public List<UserbyRoleVO> getUserInfoByRole(String roleCode, String companyId) {
        return sysmanageDataCommonClient.getUserInfoByRole(roleCode,companyId).getData();
    }


    /**
     * 根据name获取 role
     *
     * @author wst
     * @since 2019/9/18
     */
    @Override
    public List<RoleVO> getPresetRoleByName(List<String> names) {
        return sysmanageDataCommonClient.getPresetRoleByName(names).getData();
    }

    /**
     * 根据userid获取user相关
     *
     * @author maxingjian
     * @since 2019/9/18
     */
    @Override
    public  UserInfoVO getUserInfoByUserId(String userId)
    {
        return sysmanageDataCommonClient.getUserInfoByUserId(userId).getData();
    }
    
    @Override
    public List<UserInfoVO> getUserInfoList(Set<String> userIdSet) {
        return sysmanageDataCommonClient.getUserInfoList(userIdSet).getData();
    }

    /**
     * 通过userid获取经理的userid
     *      * @author maxingjian
     *      * @since 2019/11/25
     */
    @Override
    public List<String> getManagerIdByUserId(String userId, String positionCode, String orgId)
    {
        return sysmanageDataCommonClient.getManagerIdByUserId(userId,positionCode,orgId).getData();
    }

    /**
     * 根据当前人的职位id获取角色类别
     *      * @author maxingjian
     *      * @since 2019/12/31
     */
    @Override
    public String getPositionByUserOrgId(Long userOrgId)
    {
        return sysmanageDataCommonClient.getPositionByUserOrgId(userOrgId).getData();
    }

    @Override
    public List<EmployeeVO> getEmployeeByUserIds(String userIds) {
        return sysmanageDataCommonClient.getEmployeeByUserIds(userIds).getData();
    }
}
